<template>
    <div>
        {{ number }}
        <button type="button" @click="handleAddRandom">随机增加</button>
    </div>
</template>

<script>
    export default {
        props: {
            number: {
                type: Number
            }
        },
        methods: {
            handleAddRandom () {
                //随机取1-100中的数
                const num = Math.floor(Math.random()*100+1);
                this.$bus.emit('add',num);
            }
        }
    }
</script>

<style scoped>

</style>
